<html>
<head><meta charset="utf-8"><title>cfg(unstable feature) · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/cfg(unstable.20feature).html">cfg(unstable feature)</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="244336615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/cfg%28unstable%20feature%29/near/244336615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Wagner-Hall <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/cfg(unstable.20feature).html#244336615">(Jun 29 2021 at 19:45)</a>:</h4>
<p>Is there a way to conditionally compile based on whether some unstable feature is enabled for the crate? Something like <code>#[cfg(nightly_feature(trusted_len))]</code></p>



<a name="244339770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/cfg%28unstable%20feature%29/near/244339770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> The 8472 <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/cfg(unstable.20feature).html#244339770">(Jun 29 2021 at 20:07)</a>:</h4>
<p>There's RFC 2523 (<code>#[cfg(accessible(::path::to::thing))]</code>) but that's not implemented yet. So currently you have to use a cargo feature enabling the unstable feature and make things using it depend on the cargo feature.</p>



<a name="244430836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/cfg%28unstable%20feature%29/near/244430836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Henry-Mantilla <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/cfg(unstable.20feature).html#244430836">(Jun 30 2021 at 14:23)</a>:</h4>
<p>FWIW, there is also a user side helper crate: <a href="https://docs.rs/autocfg">https://docs.rs/autocfg</a></p>
<ul>
<li><a href="https://docs.rs/autocfg/1.0.1/autocfg/struct.AutoCfg.html#method.emit_has_trait">https://docs.rs/autocfg/1.0.1/autocfg/struct.AutoCfg.html#method.emit_has_trait</a></li>
</ul>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>